News for hackers. Stuff that matters.
Re:Janet: a lightweight, expressive and modern Lisp by phoe-krk on Wednesday May 13, 2020 @04:53AM (#23164907)

    janet:1:> (cons 1 2)
    compile error: unknown symbol cons on line 1, column 1 while compiling repl
    janet:2:> (list 1 2)
    compile error: unknown symbol list on line 2, column 1 while compiling repl
    janet:3:> (vector 1 2)
    compile error: unknown symbol vector on line 3, column 1 while compiling repl
I certainly need to learn the basic idioms of this dialect; it looks nothing like Common Lisp under the hood.
Re:Janet: a lightweight, expressive and modern Lisp by dmos62 on Wednesday May 13, 2020 @07:54AM (#23165900)
I found this interesting so looked it up:

    Janet 1.9.1-4ae3722 Copyright (C) 2017-2019 Calvin Rose
    janet:1:> (array 1 2 3)
    @[1 2 3]
    janet:2:> (tuple 1 2 3)
    (1 2 3)
    janet:3:> (rest (tuple 1 2 3))
    compile error: unknown symbol rest on line 3, column 1 while compiling repl
    janet:5:> (tail (tuple 1 2 3))
    compile error: unknown symbol tail on line 5, column 1 while compiling repl
    janet:6:> (car (tuple 1 2 3))
    compile error: unknown symbol car on line 6, column 1 while compiling repl
    janet:7:> (cdr (tuple 1 2 3))
    compile error: unknown symbol cdr on line 7, column 1 while compiling repl
    janet:8:> (def t (tuple 1 2 3))
    (1 2 3)
    janet:9:> (def a (array 1 2 3))
    @[1 2 3]
    janet:11:> (drop 1 t)
    (2 3)
    janet:12:> (drop 1 a)
    (2 3)
    janet:13:> (first t)
    1
    janet:14:> (first a)
    1
Re:Janet: a lightweight, expressive and modern Lisp by pjc50 on Wednesday May 13, 2020 @05:04AM (#23164966)
Is it really Lisp without cons?
Re:Janet: a lightweight, expressive and modern Lisp by pull_my_finger on Wednesday May 13, 2020 @06:35AM (#23165465)
I can understand it's a traditional name, but maybe we can appreciate that it's a new/stand-alone language and that modern/expressive function names are an improvement and a breath of fresh air.
Re:Janet: a lightweight, expressive and modern Lisp by flavio81 on Thursday May 14, 2020 @06:38PM (#23186438)
More precisely, Lisp

... without cons,

without arbitrary precision integers, fixed precision integers, rationals and complex numbers,

without image-based development,

without the conditions-restart system,

without CLOS,

etc.

It's interesting to note, since Janet is a bytecode interpreter, that we've have had a full Common Lisp implementation for years (CLISP) that provides all the features above (plus many many others) with a download size (1.8MB) just slightly bigge than to Janet's.

Re:Janet: a lightweight, expressive and modern Lisp by phoe-krk on Wednesday May 13, 2020 @05:06AM (#23164976)
Yes, it seems so. Try the REPL available at the website.
Re:Janet: a lightweight, expressive and modern Lisp by oblio on Wednesday May 13, 2020 @05:31AM (#23165093)
I wonder if his question was not rhetorical, as in: It is really Lisp if it doesn't have cons?
Re:Janet: a lightweight, expressive and modern Lisp by phoe-krk on Wednesday May 13, 2020 @05:34AM (#23165112)
That question has been a source of multiple flamewars in the past that have only made the world worse as a result. I prefer not to go down that hole again.
Re:Janet: a lightweight, expressive and modern Lisp by lispm on Wednesday May 13, 2020 @06:12AM (#23165318)
Is it really Lisp without 'lists'?

https://janet-lang.org/api/index.html

that does not mention list in meaningful ways. It seems to prefer to work with other data structures (like arrays) - which is okay, but then I won't call it a List Processor dialect.

Re:Janet: a lightweight, expressive and modern Lisp by dleslie on Wednesday May 13, 2020 @10:58AM (#23167497)
I would say no: without list processing it's not really a lisp. It's something that looks like a lisp, but isn't.
Re:Janet: a lightweight, expressive and modern Lisp by jonathanstrange on Wednesday May 13, 2020 @08:57AM (#23166415)
I don't understand why somebody downvoted you, I've seen a number of languages that look like Lisp, but are based on vectors or arrays, and that changes the language drastically. So I'm wondering, too. I was trying to find out whether Janet programs are lists or something else like arrays, but didn't find it in the docs.
Re:Janet: a lightweight, expressive and modern Lisp by bakpakin on Wednesday May 13, 2020 @09:09AM (#23166517)
This does change the language drastically - source code is represented as tuples usually, although all of the core data structures have literal forms. This means writing macros is still easy, although certain idioms like consing are usually replaced by splicing, which is like unquote-splicing in Common Lisp but more general.
Re:Janet: a lightweight, expressive and modern Lisp by hexmiles on Wednesday May 13, 2020 @04:18PM (#23171338)
as someone who dosen't know the theory what is the difference between list and array? consing and splicing?

is there a pratical difference in the way you write programs or is more of theory/implemetation detail?

Re:Janet: a lightweight, expressive and modern Lisp by bakpakin on Wednesday May 13, 2020 @08:37PM (#23173721)
A list refers to a singly-linked list, while tuples are implemented as immutable arrays. The former is flexible in that multiple lists can hare structure, and prepending to a list is an O(1) operation that does not change the original list (consing). This property allows all sorts of interesting data structures which at their core are simply lists of atoms and other lists.

Janet on the other hand just uses tuples, which are easier to pack densely into memory so usually have better cache performance on reads (clever lisp implementations can sometimes can make lists fit densely in memory, but usually they take about twice as much memory as a tuple).

splicing is the like the spread operator in JavaScript or the splat operator in Ruby. This turns out to be very useful in a language without cons for manipulating tuples in macros, even though it is not as efficient as a cons.

Re:Janet: a lightweight, expressive and modern Lisp by hexmiles on Thursday May 14, 2020 @02:45AM (#23176202)
thank you!
Re:Janet: a lightweight, expressive and modern Lisp by andrewflnr on Wednesday May 13, 2020 @03:08PM (#23170529)
What are the most prominent examples? I tend to think that vectors are a better basis for a practical language.
Re:Janet: a lightweight, expressive and modern Lisp by alexkowalenko on Wednesday May 13, 2020 @05:45AM (#23165173)
Is it a lisp without car cdr and cadaaaadmycateatsmiceadaddddr?

Just in case -

))))))))))))))))))))))))))))))))))))))