Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

new version of elm is live, with better compiler error messages http://elm-lang.org/blog/compilers-as-assistants:

Adbot
ADBOT LOVES YOU

karms
Jan 22, 2006

by Nyc_Tattoo
Yam Slacker

Suspicious Dish posted:

Wrote another article about computer.

http://magcius.github.io/xplain/article/regions.html

Please bash it to bits.

Good stuff. Especially love the interactive animations, which makes me nostalgic for my flash roots.

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
wrong thread

Sagacity
May 2, 2003
Hopefully my epitaph will be funnier than my custom title.
want to use libraries like sdl or opengl in go?

just use this simple workaround!
https://github.com/golang/go/wiki/LockOSThread

code:
Russ Cox presented a good solution for this problem in this thread.

package sdl

// Arrange that main.main runs on main thread.
func init() {
    runtime.LockOSThread()
}

// Main runs the main SDL service loop.
// The binary's main.main must call sdl.Main() to run this loop.
// Main does not return. If the binary needs to do other work, it
// must do it in separate goroutines.
func Main() {
    for f := range mainfunc {
        f()
    }
}

// queue of work to run in main thread.
var mainfunc = make(chan func())

// do runs f on the main thread.
func do(f func()) {
    done := make(chan bool, 1)
    mainfunc <- func() {
        f()
        done <- true
    }
    <-done
}
And then other functions you write in package sdl can be like

func Beep() {
    do(func() {
        // whatever must run in main thread
    })
}
More gold here: http://features.slashdot.org/story/15/11/18/1748247/interviews-alan-donovan-and-brian-kernighan-answer-your-questions

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde
During the weekend I went to the bay area Forth programming group's annual event and I thought I'd post some reflections thereon.



Neat things are happening in Forth. I say "neat," not "big." Certainly there will be no comeback, but among the presentations were many fresh ideas and examples of what Forth can do in combination with other techs.

I noted two recurring themes during this year's event:
- Recognition of JavaScript as a gotta-know-it PL. Even Chuck Moore, the notoriously NIH-minded inventor of Forth, understands this.
- Pretty much everyone, including OGs, have embraced GitHub as a community medium.

Several presenters had the combination of Forth and JavaScript involved somewhere. One guy presented a Forth->JavaScript compiler and mentioned his work on a JavaScript->Forth one. The former produces essentially bytecode for a JavaScript Forth VM. Stack ripping severely complicates the latter, but he did have a prototype for a restricted class of input programs.

Another presented a Forth-based minimalist demoscene that he's set up. I was pretty fascinated by this because I've been reading a lot about digital media theory. The Forth community tends to be predominantly EEs and embedded programmers focused on very practical applications, and it's rare to see a Forther embrace the artistic side of computing to that degree.

One of the regular presenters had some Arduinos running Forth. Each one had an attached 8x8 LED grid and a serial line to a laptop running HyperTerm. He left those running all day for people to experiment with. I tried to draw an 8x8 Sierpinski triangle on one. Sadly, since I am not a Forth programmer, I didn't even get as far as plotting a pixel. There was no built-in (1 << n) operation that I could use for masking, and the one I coded myself didn't work.

There were multiple presentations on doing things with GreenArrays, Chuck Moore's chip architecture that is like FPGAs, but with tiny clockless CPUs instead of gates. Some grad students who have presented in years past showed their progress with a C compiler for GreenArrays. There was another presentation on programming GreenArrays as a transceiver for magnetic tracking chips.

Then Chuck Moore stunned me with the news that he doesn't program close to the metal anymore; he's moving on to iPhone apps and the web. I'm not sure how far he'll get since he has a proud reputation of loathing everything that has been built above the metal during the last 60 years. Guess we'll see.

Culture shock

A graybeard presented something that was allegedly a combination of Forth and K, the latest language derived from APL. He showed his presentation in some kind of custom text-based environment that I can only describe as ncurses from Mars. I literally could not make head or tail of what he was putting on the screen, and I don't mean just the code parts. Couldn't parse his commentary either. I suppose this would be expected of a seasoned Forth/APL fan.

Many graybeards show up at the Forth group meetings. I have to respect them; they're true Silicon Valley OG's who have seen it all. Yet as I mentioned above, there is a substantial generation gap. I overheard one of the OG's saying that he was baffled by the way the grad students used the computer in their presentation. But their presentation was all done in xterms on Linux. Everything they were doing, UI-wise, was being done in the 1980s.

Not every Forth OG ends up this way. In 2006 or so I encountered Leo Brodie, who wrote the most popular intro book on Forth, when we both worked at RealNetworks. His skills are current and he communicated just fine with young folks. He had a copy of his book on his shelf, but he didn't give the impression that he swears by it.

Moral of the story: Explore the nooks and crannies of technology; learn from them what you can, but don't settle down in them or the world will leave you behind.

Gazpacho fucked around with this message at 07:45 on Nov 24, 2015

Cybernetic Vermin
Apr 18, 2005

Gazpacho posted:

A graybeard presented something that was allegedly a combination of Forth and K, the latest language derived from APL. He showed his presentation in some kind of custom text-based environment that I can only describe as ncurses from Mars. I literally could not make head or tail of what he was putting on the screen, and I don't mean just the code parts. Couldn't parse his commentary either. I suppose this would be expected of a seasoned Forth/APL fan.

Any more details (names, urls?) on this? K remains one of my great loves, but suffers from its proprietary nature (as well as from being entirely incomprehensible until you have some practice, which I understand has been carried over).

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde
good luck

https://www.youtube.com/watch?v=0u2_jKfo0A8&t=10151s

http://cosy.com/CoSy/4th.CoSy.html

the presentation software he used was his own version of CoSy, some 1980s collab system along the lines of Engelbart's NLS I guess? still mystified and kinda suspect that he might be nuts

Gazpacho fucked around with this message at 08:47 on Nov 24, 2015

gonadic io
Feb 16, 2011

>>=

Gazpacho posted:

Moral of the story: Explore the nooks and crannies of technology; learn from them what you can, but don't settle down in them or the world will leave you behind.

This is why I'm glad left haskell, both the community and the language. I miss is, but I'm doing something different and learning new things in a way that I wouldn't be otherwise

gonadic io fucked around with this message at 09:23 on Nov 24, 2015

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

Cybernetic Vermin posted:

Any more details (names, urls?) on this? K remains one of my great loves, but suffers from its proprietary nature (as well as from being entirely incomprehensible until you have some practice, which I understand has been carried over).

*opens wikipedia*

quote:

code:
2!!7!4
Reading from right to left the first ! is modulo division that is performed on 7 and 4 resulting in 3. The next ! is enumeration and lists the integers less than 3, resulting in the list 0 1 2. The final ! is rotation where the list on the right is rotated two times to the left producing the final result of 2 0 1.

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

Gazpacho posted:

and kinda suspect that he might be nuts

probably. doesn't make him wrong or uninformed!

dude sounds like the dude, btw.

Cybernetic Vermin
Apr 18, 2005

fart simpson posted:

*opens wikipedia*

enjoy instead this production-level xml parser shipped with the system: http://kx.com/a/k/examples/xml.k

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

nope lol

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

Cybernetic Vermin posted:

enjoy instead this production-level xml parser shipped with the system: http://kx.com/a/k/examples/xml.k

that file must be corrupt because all i got was a screenful of noise

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."

Cybernetic Vermin posted:

Any more details (names, urls?) on this? K remains one of my great loves, but suffers from its proprietary nature (as well as from being entirely incomprehensible until you have some practice, which I understand has been carried over).

How about a browser-based implementation of K with a set of graphical programming extensions that can be used to make pointless but pretty tech demo things?

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde
sup IJ, glad u stopped by

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."
You guys were basically launching signal flares with my name on them.

It's very interesting to see that the Forth and APL communities seem to have so much overlap. "write only" languages evidently have to stick together. One of these years I'm seriously going to have to make the trip to Forth Day- thanks for the trip report, Gazpacho.

edit:
Listened to the CoSy talk. It was a bit meandering and rambly but I think it mostly made sense to me.

CoSy aims to be a forth-like, low-level language and programming environment which provides direct access to hardware, with the high level expression and data manipulation of APL. APL implies managed memory, so CoSy, like K, uses reference counting.

CoSy structures have a uniform header structure which tracks a type (including types for unityped vectors versus heterogenous lists), a size, a refcount and a slot which permits any data structure to be annotated with arbitrary metadata- similar to Lisp plists.

Forth typically stores all static data and word definitions in a dictionary. Special words for manipulating this dictionary are part of a typical kernel, and for most purposes it is append-only. CoSy keeps its dictionary in one of its refcounted structures (named R), permitting all the APL-style words to operate on it.

Recommended video, a Google Tech Talk about the current state of Dyalog APL:

https://youtu.be/PlM9BXfu7UY

For the most part the curses ASCII-art visuals are just the way code or comments happen to be formatted for the presentation, and don't have anything to do with the language. It looks like the pipe character (|) is being used to delimit line comments, if that helps. You can see some evidence of a "block oriented" approach to breaking up/storing code in fixed-size "pages", which is a historical artifact of how early forth systems and their built-in text editors worked. The IDE you can see in most of the presentation has a REPL output panel on top and a persistent text editor at the bottom, and the presenter is navigating his notes and occasionally evaluating fragments of them, displayed at the top.

Emphasis is placed on CoSy's features for searching, timestamping, and interactively testing code- CoSy is essentially similar to Mathematica's "workbook" concept of blended interactive examples, output and notes, centered around a Forthy environment and permitting dropping into x86 assembly language when desired.

Internet Janitor fucked around with this message at 21:20 on Nov 24, 2015

Arcsech
Aug 5, 2008
Perl 6 looks pretty cool. It's still Perl, but it's unicode handling looks pretty legit, and built in grammars are neat. Also a static type system

Plus a bunch of modernization like better functional junk, proper OO, etc.

b0lt
Apr 29, 2005

Arcsech posted:

Also a static type system

a static type system with an insane set of built in types.

what do Array, Backtrace, Bool, Int, Map, List, Set, and Str have in common? among other things, they all have an arccotangent method

Arcsech
Aug 5, 2008

b0lt posted:

a static type system with an insane set of built in types.

what do Array, Backtrace, Bool, Int, Map, List, Set, and Str have in common? among other things, they all have an arccotangent method

wait why the gently caress does all of this poo poo inherit from Cool? I admit I hadn't looked at it very closely

that seems like a very poor decision, most of Cool's methods dont make sense on most of those types

for those not familiar: Cool is perl6's name for a type that can be treated as either a string or a number depending on context, and here's the list of types that inherit from it: Array Backtrace Bag Baggy Bool Complex Cool Duration Enumeration Map FatRat Hash Instant Int KeyHash KeySet List Match Nil Num Numeric Range Real Seq Set Stash Str Stringy

so all of the above types have an arccotangent and an uppercase method.

Arcsech fucked around with this message at 05:59 on Nov 29, 2015

Arcsech
Aug 5, 2008
actually i suppose it kind of makes sense - all of the stdlib stuff that needs to work with dynamically typed stuff takes Cools to help it work with gradually typed stuff. kinda seems like the solution is to just never ever use Cool in your own code

still really fuckin plangy though

brap
Aug 23, 2004

Grimey Drawer
perl sounds like a loving dumpster fire of a language

also lol at how all dynamically typed languages try to crawl toward static typing eventually. dynamic typing is so lovely.

b0lt
Apr 29, 2005

Arcsech posted:

actually i suppose it kind of makes sense - all of the stdlib stuff that needs to work with dynamically typed stuff takes Cools to help it work with gradually typed stuff. kinda seems like the solution is to just never ever use Cool in your own code

still really fuckin plangy though

i can't believe i didn't see your username

although, asech shows up twice consecutively in the table of what methods coerce to what and zero times in the actual list of methods, lol??

they actually seem to be missing a lot of the hyperbolic trig functions. what will i do when i want to compute the hyperbolic cosecant of my backtrace????

FamDav
Mar 29, 2008
what is a fatrat

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

whats a baggy

Cybernetic Vermin
Apr 18, 2005

FamDav posted:

what is a fatrat

arbitrary precision rational number

Ericadia
Oct 31, 2007

Not A Unicorn

gonadic io posted:

This is why I'm glad left haskell, both the community and the language. I miss is, but I'm doing something different and learning new things in a way that I wouldn't be otherwise

I'm learning it on my free time, any warnings or favorite bits of the language you'd care to share?

gonadic io
Feb 16, 2011

>>=

Ericadia posted:

I'm learning it on my free time, any warnings or favorite bits of the language you'd care to share?

i love answering questions about it, so just ask if you need anything. yes the syntax using spaces for both function application and pattern matching (although they can never be done in the same place so there's no language ambiguity) takes some getting used to, it'll come in time.

2 most common mistakes for beginners:
- 'return' doesn't do what you expect it to coming from OO so
code:
do
    if butt
        then return true
        else return false
    error "how did I get here????"
throws the exception
- this is the same for all languages, but it bites really hard in haskell: recognise the weaknesses of the default list time which is singly-linked. If you find yourself using (!!), especially in a loop, take a real hard think about whether an array or set (mutable or immutable) would be a better choice. By extension, the default String type (a singly linked list of chars) is really really bad for most string-type operations. The library Data.Text is rich and really fast.

Learn you a haskell is the standard first recommended text, then if you want to see some more complicated but better uses once you've finished that i'd recommend parallel and concurrent programming in haskell (both available for free online).

if you feel lost, then start writing code in it just to practice. i (and also the haskell subreddit) are very happy to give tips. haskell is one of the more beginner friendly lang's communities i've come across

gonadic io fucked around with this message at 16:29 on Nov 29, 2015

gonadic io
Feb 16, 2011

>>=
as for favourite parts, well, statically-verified pattern matching is just the best. it's amazing. i wish absolutely every language had it and the lightweight way to declare unions/records that ADTs (haskell's 'data' keyword) gives you.

if you find yourself with a lot of nested data fields (like when programming with rich datastructures like json or a game state or whatever), then it's probably worth learning how to use (although never look at the source) lens or one if it's clones.

qntm
Jun 17, 2009

FamDav posted:

what is a fatrat

you're going to love the method FatRat.nude

qntm
Jun 17, 2009
the standard defence for Perl 6's asinine design decisions seems to be "Aww, some people just don't like fun!"

Soricidus
Oct 21, 2010
freedom-hating statist shill

FamDav posted:

what is a fatrat

it's u!!!

Vanadium
Jan 8, 2005

I can't believe the perl6 people stuck to making == converts strings to numbers to compare them

Vanadium
Jan 8, 2005

http://bitemyapp.com/posts/2014-12-31-functional-education.html how do people feel about these learning-haskell recommendations

Ericadia
Oct 31, 2007

Not A Unicorn

gonadic io posted:

recognise the weaknesses of the default list time which is singly-linked
ah, I was wondering how they were implemented, and I can see why !! could be a problem now. I haven't messed with arrays or set types yet, I must not be far enough along in Learn You a Haskell. That's a good tip about Data.Text. Are there any books that talk about haskell from an linguistics perspective, or at least do a quick survey? I'm always interested in learning about language implementation/thought

gonadic io posted:

as for favourite parts, well, statically-verified pattern matching is just the best. it's amazing. i wish absolutely every language had it and the lightweight way to declare unions/records that ADTs (haskell's 'data' keyword) gives you.
:agreed: when I show haskell pattern matching to my class mates they typically look confused before suddenly realizing that yes, it really is that simple lol

I will say that readability has been an issue for me coming from a mostly C++ background. For example, I stared at the quick sort implementation for a long time before I understood exactly what was going on
code:
qsort [] = []
qsort (x:xs) = qsort [y | y <- xs, y < x] ++ [x] ++ qsort [y | y <- xs, y >= x]

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

idk i used lyah and then just forced myself to start using haskell for projects, asking questions when i got stuck. that worked ok for me

gonadic io
Feb 16, 2011

>>=

if you split that up using 'where' and use 'filter' instead of list comprehensions, it becomes a lot clearer imo

this is what i'd write it as (no actually I'd write it as data.list.sort which is a merge sort but let's ignore that for now). also i'd use data.list.partition instead of two separate filters but i'll leave that as an exercise
code:
qsort :: Ord a => [a] -> [a]
qsort [] = []
qsort (x:xs) = qsort lessThan ++ [x] ++ qsort greaterThan
    where
    lessThan = filter (< x) xs
    greaterThan = filter (>= x) xs
feel free to add extra parens if it makes it easier for you too.

gonadic io fucked around with this message at 19:30 on Nov 29, 2015

fart simpson
Jul 2, 2005

DEATH TO AMERICA
:xickos:

i think the haskell style guides recommend not using list comprehensions anymore

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde
me circa 1999: perl is the best language ever! use it for everything!

me now: I will be glad never to touch perl again

Jerry Bindle
May 16, 2003
i too had a perl boner circa '99, i remember hearing about perl 6 then. are they still working on it?? who would use it. sheesh

Adbot
ADBOT LOVES YOU

qntm
Jun 17, 2009
Perl 5 was and remains a massive, massive, wholly welcome improvement on Bash scripting.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply